﻿using System.Collections.Generic;
using System.Linq;
using WebsiteImages.Models;

namespace WebsiteImages.Repository
{
    public class WebsiteImageRepository: BaseRepository, IWebsiteImageRepository
    {
        public WebsiteImage Find(int id)
        {
            var result = DB.WebsiteImage.Find(id);
            return result;
        }

        public void Add(WebsiteImage websiteImage)
        {
            DB.WebsiteImage.Add(websiteImage);
            SaveChanges();
        }

        public void Delete(int id)
        {
            var data = Find(id);
            DB.WebsiteImage.Remove(data);
            SaveChanges();
        }

        public List<WebsiteImage> WebsiteImages()
        {
            var result = DB.WebsiteImage.ToList();
            return result;
        }
    }
}